//
// Created by lenovo on 24-12-25.
//

#include <algorithm>
#include <string>
using namespace std;

class Solution
{
public:
    static string reverseWords(string s)
    {
        int i = 0;
        int n = s.size();

        while(i<n)
        {
            int sta = i;
            while(i<n && s[i]!=' ')
            {
                i++;
            }
            std::reverse(s.begin()+sta, s.begin()+i);
            i++;
        }
        return s;
    }
};
